package com.briup.pts.web.controller;

import com.briup.pts.config.response.Result;
import com.briup.pts.service.AnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Tag(name = "首页大屏数据展示模块")
@RestController
@RequestMapping("/analysis")
@RequiredArgsConstructor
public class AnalysisController {

    private final AnalysisService analysisService;

    @Operation(summary = "统计栏舍，栏圈，动物数量，冷库数量，员工数量信息接口")
    @GetMapping("/count")
    public Result<Map<String, List<?>>> count(){
        Map<String, List<?>> count = analysisService.count();
        return Result.success(count);
    }

    @Operation(summary = "统计动物体重信息接口")
    @GetMapping("/indexCount")
    public Result<Map<String,Integer>> indexCount(){
        Map<String,Integer> indexCount= analysisService.indexCount();
        return Result.success(indexCount);
    }

    @Operation(summary = "统计动物病症数量接口")
    @GetMapping("/countDisease")
    public Result<?> countDisease(){
        Map<String,Integer> countDisease = analysisService.countDisease();
        return Result.success(countDisease);
    }

    @Operation(summary = "统计本年度12个月销售动物接口")
    @GetMapping("/countSales")
    public Result<?> countSales(){
        Map<String, List<?>> countSales = analysisService.countSales();
        return Result.success(countSales);
    }
}
